package com.jjlin.chapter_5;

import java.util.*;
public class CD132{

    //找到指定类型的新类型字符
    public static String pointNewChar(String s, int k){
        if(s == null || s.length() <= k || "".equals(s))
            return "";
        int num = 0;
        char[] ch = s.toCharArray();
        for(int i = k - 1; i >= 0; i--){//从位置k - 1开始，向左统计连续出现的大写字母的数量num
            if(Character.isLowerCase(ch[i]))
                break;
            num++;
        }
        if((num & 1) == 1) //num为奇数，返回s[k-1..k]
            return s.substring(k - 1, k + 1);
        if(Character.isLowerCase(ch[k])) //num为偶数且s[k]为小写字母，返回s[k]
            return s.substring(k, k + 1);
        else //num为偶数且s[k]为大写字母，返回s[k..k+1]
            return s.substring(k, k + 2);
    }

    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        String s = sc.next();//注意next()和nextLine()的区别
        System.out.println(pointNewChar(s, k));
    }
}
